//
//  WTFDRightTableViewCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/18.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "WTFDRightTableViewCell.h"

@implementation WTFDRightTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    [self addSubview:self.leftView];
    [_leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.width.equalTo(@85);
        make.top.equalTo(@0);
        make.bottom.equalTo(@0);
    }];
    [self addSubview:self.rightView];
    [_rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftView.mas_right);
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@30);
        make.bottom.equalTo(@0);
    }];
    
    [_leftView addSubview:self.circleImageView];
    [_circleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@0).offset(-10);
        make.top.equalTo(@55);
        make.width.equalTo(@13);
        make.height.equalTo(@13);
    }];
    [_leftView addSubview:self.titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.circleImageView.mas_left).offset(-10);
        make.bottom.equalTo(self.circleImageView.mas_top);
        make.left.equalTo(@10);
        make.height.equalTo(@20);
    }];
    [_leftView addSubview:self.timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_left);
        make.top.equalTo(self.titleLabel.mas_bottom);
        make.right.equalTo(self.titleLabel.mas_right);
        make.height.equalTo(@20);
    }];
    
    
    [_rightView addSubview:self.backImageView];
    [_backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@6);
        make.bottom.equalTo(@0);
    }];
    [_backImageView addSubview:self.headerImageView];
    [_headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@20);
        make.top.equalTo(@6);
        make.width.equalTo(@30);
        make.height.equalTo(@30);
    }];
    [_backImageView addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImageView.mas_right).offset(10);
        make.centerY.equalTo(self.headerImageView.mas_centerY);
        make.width.equalTo(@100);
        make.height.equalTo(@12);
    }];
    [_backImageView addSubview:self.detailLabel];
    [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.mas_right).offset(10);
        make.centerY.equalTo(self.nameLabel.mas_centerY);
        make.right.equalTo(@0).offset(-50);
        make.height.equalTo(@12);
    }];
    [_backImageView addSubview:self.editeButton];
    [_editeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@0).offset(-10);
        make.centerY.equalTo(self.nameLabel.mas_centerY);
        make.width.equalTo(@20);
        make.height.equalTo(@20);
    }];
    
    [_backImageView addSubview:self.contentBackImage];
    [_contentBackImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImageView.mas_left);
        make.top.equalTo(self.headerImageView.mas_bottom).offset(6);
        make.right.equalTo(@0).offset(-10);
        make.bottom.equalTo(@0).offset(-40);
    }];
    
    [_backImageView addSubview:self.collectionButton];
    [_collectionButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@40);
        make.bottom.equalTo(@0).offset(-12);
        make.width.equalTo(@22);
        make.height.equalTo(@22);
    }];
    
    [_leftView addSubview:self.lineView];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.circleImageView.mas_centerX);
        make.top.equalTo(self.circleImageView.mas_bottom);
        make.bottom.equalTo(@0);
        make.width.equalTo(@1);
    }];
    
    [_leftView addSubview:self.topLineView];
    [_topLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.circleImageView.mas_centerX);
        make.top.equalTo(@0);
        make.bottom.equalTo(self.circleImageView.mas_top);
        make.width.equalTo(@1);
    }];
}
- (UIView *)leftView{
    if (!_leftView) {
        UIView *view = [[UIView alloc]init];
        _leftView = view;
    }
    return _leftView;
}
- (UIView *)rightView{
    if (!_rightView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
        view.layer.masksToBounds = YES;
        view.layer.cornerRadius = 6;
        _rightView = view;
    }
    return _rightView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(610.5,108.5,35,10.5);
        label.numberOfLines = 0;
        label.textAlignment = 1;
        label.text = @"10:08";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = SELECTEDCOLOR;
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UIImageView *)circleImageView{
    if (!_circleImageView) {
        UIImageView *image = [[UIImageView alloc]init];
        image.image = [UIImage imageNamed:@"circle_buke"];
        _circleImageView = image;
    }
    return _circleImageView;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.frame = CGRectMake(618,131.5,27.5,9);
        label.numberOfLines = 0;
        label.textAlignment = 2;
        label.text = @"3-27";
        label.textColor = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _timeLabel = label;
    }
    return _timeLabel;
}
- (UIImageView *)backImageView{
    if (!_backImageView) {
        UIImageView *imagView = [[UIImageView alloc]init];
        //imagView.image = [UIImage imageNamed:@"441555569138_.pic_hd"];
        imagView.userInteractionEnabled = YES;
        _backImageView = imagView;
    }
    return _backImageView;
}
- (UIImageView *)headerImageView{
    if (!_headerImageView) {
        UIImageView *image = [[UIImageView alloc]init];
        image.backgroundColor = [UIColor lightGrayColor];
        image.layer.cornerRadius = 15;
        image.layer.masksToBounds = YES;
        _headerImageView = image;
    }
    return _headerImageView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(610.5,108.5,35,10.5);
        label.numberOfLines = 0;
        label.textAlignment = 0;
        label.text = @"王子怡";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = SELECTEDCOLOR;
        _nameLabel = label;
    }
    return _nameLabel;
}
- (UILabel *)detailLabel{
    if (!_detailLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(610.5,108.5,35,10.5);
        label.numberOfLines = 0;
        label.textAlignment = 0;
        label.text = @"Are you ok !";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = TITLECOLOR;
        _detailLabel = label;
    }
    return _detailLabel;
}

- (UIButton *)editeButton{
    if (!_editeButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setImage:[UIImage imageNamed:@"bianJi_buke"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(editeClick:) forControlEvents:UIControlEventTouchUpInside];
        _editeButton = button;
    }
    return _editeButton;
}
- (void)editeClick:(UIButton *)sender{
    
}
- (UIImageView *)contentBackImage{
    if (!_contentBackImage) {
        UIImageView *image = [[UIImageView alloc]init];
        image.backgroundColor = [UIColor lightGrayColor];
        _contentBackImage = image;
    }
    return _contentBackImage;
}
- (UIButton *)collectionButton{
    if (!_collectionButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setImage:[UIImage imageNamed:@"u4676"] forState:UIControlStateNormal];
        [button setImage:[UIImage imageNamed:@"u4676"] forState:UIControlStateSelected];
        [button addTarget:self action:@selector(collectionButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        _collectionButton = button;
    }
    return _collectionButton;
}
- (void)collectionButtonClick:(UIButton *)sender{
    
}
- (UIView *)lineView{
    if (!_lineView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = [UIColor lightGrayColor];
        _lineView = view;
    }
    return _lineView;
}
- (UIView *)topLineView{
    if (!_topLineView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = [UIColor lightGrayColor];
        _topLineView = view;
    }
    return _topLineView;
}
@end
